import java.util.Iterator;

public class StringIterator implements Iterator {
	private char[] nextString;
	private String terminalString;

	public StringIterator() {
		this.nextString = new char[] { 'A', 'A', 'A', 'A', 'A' };
		terminalString = "TTTTT";
	}
	
	public StringIterator(int length){
		this.nextString = new char[length];
		terminalString = "";
		for(int i=0;i<length;i++){
			nextString[i] = 'A';
			terminalString += 'T';
		}
		
	}

	public boolean hasNext() {
		if (nextString == null) {
			return false;
		}
		return true;
	}

	public void remove() {

	}

	public String next() {
		
		String returnString = new String(nextString);
		
		if(returnString.equals(terminalString))
			nextString = null;
		else {
			for (int i = 0; i < nextString.length; i++) {
				if (nextString[i] == 'T') {
					nextString[i] = 'A';
				} else {
					switch (nextString[i]) {
					case 'A':
						nextString[i] = 'C';
						break;
					case 'C':
						nextString[i] = 'G';
						break;
					case 'G':
						nextString[i] = 'T';
						break;
					default:
						break;
					}
					break;
				}
			}
		}

		return returnString;
	}
}